const CryptoJS = require("crypto-js");
const secretKey = "secret key ofa";
const AESsecretKey = "23acf884d8a6adcd";
const iv = '0000000000000000'

export function cryptoMD5 (str:string):string {
    return CryptoJS.MD5(str).toString();
}


// 带偏移量的AES加密
export  function encryptAES (secretStr:string, customSecretKey:string = secretKey, customOptions:object = {
    iv: CryptoJS.enc.Utf8.parse(iv)
  }) {
  const key = customSecretKey || AESsecretKey
  const options = customOptions
  return CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(secretStr), CryptoJS.enc.Utf8.parse(key), options).toString();
}